Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
mukeshpanchal27
left a comment
There was a problem hiding this comment.
The change looks good. wp_unique_filename() always returns a string, so assertNotSame() behaves the same as assertNotEquals() here. It also matches the other strict comparison commits for #64895. This was the only assertNotEquals() call in file.php.
One small note on the description, which does not block this change. For a "not" assertion, assertNotSame() is the less strict choice. For example, assertNotSame( 1, "1" ) passes, but assertNotEquals( 1, "1" ) fails. The change is still right for consistency, but the "prevents false passes" sentence does not apply to this assertion.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the test-only assertion change.
No open issues 🎉
What changed in this PR
Updates the file uniqueness test to use an identity-based comparison for generated filenames, following the assertion cleanup associated with Trac #64895.
Changes:
- Replaces
assertNotEquals()withassertNotSame()when comparing two generated filenames. - Changes only the test assertion; production code is unchanged.
| File | Description |
|---|---|
tests/phpunit/tests/file.php |
Uses assertNotSame() to check that generated filenames differ. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
Both generated filenames are strings, so this preserves the uniqueness check while using the strict comparison convention.
Reviewed with the unit-tests audit. The affected classes passed locally in single-site and multisite with random-order seeds 14610 and 64895; PHPCS and CI are green. Copilot reported no open issues.
AI review · gpt-6
Use `assertNotSame()` when comparing the two filename strings returned by `wp_unique_filename()`. Preserve the checks that both files can be created and written. Developed in: #14857 Props hmbashar, mukesh27. See #64895. git-svn-id: https://develop.svn.wordpress.org/trunk@64825 602fd350-edb4-49c9-b593-d223f7449a82
|
PR #14857 landed in https://core.trac.wordpress.org/changeset/64825 |
Use `assertNotSame()` when comparing the two filename strings returned by `wp_unique_filename()`. Preserve the checks that both files can be created and written. Developed in: WordPress/wordpress-develop#14857 Props hmbashar, mukesh27. See #64895. Built from https://develop.svn.wordpress.org/trunk@64825 git-svn-id: http://core.svn.wordpress.org/trunk@63975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Description
Converts
assertNotEquals()toassertNotSame()intests/phpunit/tests/file.phpwhere values are scalar (strings, URLs, integers, booleans). Follow-up to Trac #64895.assertNotSame()is stricter — it checks both value and type equality, preventing false passes from type coercion.Changes
tests/phpunit/tests/file.php: ReplaceassertNotEquals()withassertNotSame()for scalar comparisonsHow to test
phpunit tests/phpunit/tests/file.phpSee Trac #64895
Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): claude-sonnet-5-5
Used for: Code implementation and test; reviewed and verified by contributor.